package sis.threadtest;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-08-02 19:25
 * @notify
 * @version 1.0
 */

public class ThreadExceptionTest extends Thread {
    public void run() {
        int i = 10 / 0;
    }

    public static void main(String[] args) {
        ThreadExceptionTest thread = new ThreadExceptionTest();
        thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            public void uncaughtException(Thread th, Throwable tw) {
                System.out.println("出异常了");
            }
        });
        thread.start();
    }
}
